import httpRequest from "@/request";
import { WdLayout } from "@/types/request";

interface Login {
  account: string;
  password: string;
}
interface WdLogin {
  user: any;
  access_token: string;
}

export default {
  /**
   * 登录接口
   * @param data 用户名密码
   * @returns
   */
  login: (data: Login) => {
    return httpRequest.post<WdLayout<WdLogin>>({
      url: `login`,
      data,
      showLoading: false,
    });
  },
  //  注册账号
  register: (data: Login) => {
    return httpRequest.post<WdLayout<WdLogin>>({
      url: `login/register`,
      data,
      showLoading: false,
    });
  },
};
